using GameFramework.Localization;
using Unity.VisualScripting;
using UnityEngine;
using UnityGameFramework.Runtime;

namespace LS.UGFUnits
{
    [UnitSurtitle("Config Property")]
    [UnitShortTitle("Get")]
    public sealed class GetConfigProperty : ConfigUnit
    {
        [DoNotSerialize]
        public ValueOutput Count { get; private set; }

        [DoNotSerialize]
        public ValueOutput CachedBytesSize { get; private set; }
        
        protected override void Definition()
        {
            base.Definition();
            Count = ValueOutput<int>(nameof(Count));
            CachedBytesSize = ValueOutput<int>(nameof(CachedBytesSize));
        }

        protected override ControlOutput In(Flow flow)
        {
            flow.SetValue(Count, Target?.Count ?? 0);
            flow.SetValue(CachedBytesSize, Target?.CachedBytesSize ?? 0);
            return base.In(flow);
        }
    }
}